import { UPLOAD_URL } from "./constant";
export const upload = (name, filePath) => {
  return new Promise((resolve, reject) => {
    uni.uploadFile({
      url: UPLOAD_URL,
      filePath,
      name,
      header: {
        "Content-Type": "multipart/form-data",
        Authorization: uni.getStorageSync("token"),
      },
      success: (res) => {
        resolve(res.data);
      },
      fail: (err) => {
        reject(err.data);
      },
    });
  });
};
